package cn.edu.scau.cmi.suwenpeng.chapter05;

class B_exercise9 {
	int n;
	static int sum=0;
	void setN(int n) {
		this.n=n;
	}
	int getSum() {
		for(int i=1;i<n;i++) {
			sum=sum+n;
		}
		return sum;
	}
}

public class A_exercise9 {

	public static void main(String[] args) {
		B_exercise9 b1=new B_exercise9(),b2=new B_exercise9();
     b1.setN(3);
     b2.setN(5);
     int s1=b1.getSum();
     int s2=b2.getSum();
     System.out.println(s1+s2);
	}

}